package com.utils;

import java.text.SimpleDateFormat;

import org.json.JSONObject;

import android.util.Log;

public class Constants {
	
	public static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
	
	public static final String KEY_CONSTANTS_DATA = "CONSTANTS_DATA";
	public static final String KEY_DEVICE_DETAILS_DATA = "DEVICE_DETAILS_DATA";
	public static final String KEY_IS_REGISTER = "IS_REGISTER";
	public static final String KEY_PHONE_NO = "PHONE_NO";
	public static final String KEY_FILE_NAMES = "FILE_NAMES";
	
	public static final String KEY_REGISTER_NOTIFICATION = "REGISTER_NOTIFICATION";
	public static final String KEY_SMS_CODE = "SMS_CODE";
	
	public static final String KEY_SMS_SENT_TO = "KEY_SMS_SENT_TO";
	
	public static final String KEY_COUNTRY = "COUNTRY";
	public static final String KEY_COUNTRY_CODE = "COUNTRY_CODE";
	
	public static final String IMEI_NO = "k1";
	public static final String PHONE_NO = "k2";
	
	public static final String KEY_SUPER_CATEGORY_ID = "SUPER_CATEGORY_ID";
	public static final String KEY_SUPER_CATEGORY_NAME = "SUPER_CATEGORY_NAME";
	public static final String KEY_SUPER_CATEGORY_DATA = "SUPER_CATEGORY_DATA";
	
	public static final String KEY_CATEGORY_ID = "CATEGORY_ID";
	public static final String KEY_CATEGORY_NAME = "CATEGORY_NAME";
	public static final String KEY_SEARCH_KEY = "KEY_SEARCH_KEY";
	
	public static final String KEY_CAT_INFO = "CAT_INFO";
	
	public static final String KEY_IS_FROM_MY_APP = "IS_FROM_MY_APP";
	
	public static final String KEY_BANNER_DETAILS = "BANNER_DETAILS";
	
	public static final String KEY_AD_ID = "AD_ID";
	public static final String KEY_AD_TEXT = "AD_TEXT";
	public static final String KEY_IS_SOLD = "KEY_IS_SOLD";
	
	
	
//	public static final String KEY_REG_CODE = "REG_CODE";
//	public static final String KEY_REG_PHONE_NO = "REG_PHONE_NO";
	
	public static final String COUNTRY_KUWAIT = "KUWAIT";
	public static final String COUNTRY_UAE = "UAE";
	
	public static final String COUNTRY_CODE_KUWAIT = "KW";
	public static final String COUNTRY_CODE_UAE = "AE";
	public static final String PHONE_CODE_KUWAIT = "+965";
	public static final String PHONE_CODE_UAE = "+971";
	public static final int SMS_CODE_LENGTH = 6;
	public static final int NUMBER_OF_PHONE_DIGIT_KUWAIT = 8;
	public static final int NUMBER_OF_PHONE_DIGIT_UAE = 9;
	
	
	public static final int BG_EVEN_CELL = 0x33CCCCCC;
	public static final int BG_ODD_CELL = 0x33007FE5;
	
	public static final String KEY_AD_TYPE = "AD_TYPE";
	public static final int TYPE_NORMAL_AD = 1;
	public static final int TYPE_FEATURE_AD = 0;
	public static final int TYPE_DEALS_AD = 2;
	
	public static final String KEY_CATEGORY_TYPE = "CATEGORY_TYPE";
	public static final int TYPE_NORMAL_CAT = 1;
	public static final int TYPE_FEATURE_CAT = 0;
	public static final int TYPE_DEALS_CAT = 2;
	
	public static final int AD_STATUS_SOLD = 2;
	
	public static final int DEVICE_TYPE_ANDROID = 0;
	public static final int DEVICE_TYPE_IPHONE = 1;
	
	public static final int MIN_IMAGES = 0;
	public static final int MAX_IMAGES = 5;
	
	public static final int IMAGE_DIMENSION = 512;
	
	public static final int CYCLE_OF_POST_AD = 30;
//	public static final int MAX_NUMBER_OF_CAN_BE_POST_IN_CYCLE = 100;
	
	public static final String ENCODING_TYPE = "UTF-8";
	
	public static final int NUMBER_OF_ROW_PERPAGE = 20;
	
	
	
	
	
	
	private static final String SPLASH_IMAGE_DIR_CONSTANT_NAME = "splash_img_dir";
	private static String splashImageDirName;
	private static final String SUPER_CATEGORY_IMAGE_THUMB_DIR_CONSTANT_NAME = "super_category_img_dir_thumb";
	private static String superCatImgThumbDirName;
	private static final String CATEGORY_IMAGE_THUMB_DIR_CONSTANT_NAME = "category_img_dir_thumb";
	private static String catImgThumbDirName;
	private static final String DEFAULT_IMAGE_DIR_NAME = "default_img_dir";
	private static String defaultImgDirName;
	private static final String DEFAULT_IMAGE_FILE_NAME = "default_img_file_name";	
	private static String defaultImgFileName;	
	private static final String AD_IMAGE_THUMB_DIR_CONSTANT_NAME = "ad_img_dir_thumb";
	private static String adImgThumbDirName;
	private static final String AD_IMAGE_DIR_CONSTANT_NAME = "ad_img_dir";
	private static String adImgDirName;
	private static final String BANNER_SMALL_IMAGE_DIR_NAME = "banner_img_dir_small";
	private static String bannerSmallImgDirName;
	private static final String BANNER_BIG_IMAGE_DIR_NAME = "banner_img_dir_big";
	private static String bannerBigImgDirName;
	
	private static final String TERMS_AND_CONDITION = "terms_conditions";
	private static String termsAndConditions;
	
	private static final String MAX_POST_IN_MONTH = "max_post_in_month";
	private static int maxPostInMonth = 30;
	
	
	private static final String SERVICE_DISABLED = "SERVICE_DISABLED";
	private static boolean isServiceDisabled;
	private static final String DEAL_DISABLED = "DEAL_DISABLED";
	private static boolean isDealDisabled;
	
	public static final void initConstants(String con){
		try {
			JSONObject jConstants = new JSONObject(con);
			if(!jConstants.isNull(SPLASH_IMAGE_DIR_CONSTANT_NAME)){
				splashImageDirName = jConstants.getString(SPLASH_IMAGE_DIR_CONSTANT_NAME);
			}
			if(!jConstants.isNull(SUPER_CATEGORY_IMAGE_THUMB_DIR_CONSTANT_NAME)){
				superCatImgThumbDirName = jConstants.getString(SUPER_CATEGORY_IMAGE_THUMB_DIR_CONSTANT_NAME);
			}
			if(!jConstants.isNull(CATEGORY_IMAGE_THUMB_DIR_CONSTANT_NAME)){
				catImgThumbDirName = jConstants.getString(CATEGORY_IMAGE_THUMB_DIR_CONSTANT_NAME);
			}
			if(!jConstants.isNull(DEFAULT_IMAGE_DIR_NAME)){
				defaultImgDirName = jConstants.getString(DEFAULT_IMAGE_DIR_NAME);
			}
			if(!jConstants.isNull(DEFAULT_IMAGE_FILE_NAME)){
				defaultImgFileName = jConstants.getString(DEFAULT_IMAGE_FILE_NAME);
			}
			if(!jConstants.isNull(AD_IMAGE_THUMB_DIR_CONSTANT_NAME)){
				adImgThumbDirName = jConstants.getString(AD_IMAGE_THUMB_DIR_CONSTANT_NAME);
			}
			if(!jConstants.isNull(AD_IMAGE_DIR_CONSTANT_NAME)){
				adImgDirName = jConstants.getString(AD_IMAGE_DIR_CONSTANT_NAME);
			}
			if(!jConstants.isNull(BANNER_SMALL_IMAGE_DIR_NAME)){
				bannerSmallImgDirName = jConstants.getString(BANNER_SMALL_IMAGE_DIR_NAME);
			}
			if(!jConstants.isNull(BANNER_BIG_IMAGE_DIR_NAME)){
				bannerBigImgDirName = jConstants.getString(BANNER_BIG_IMAGE_DIR_NAME);
			}
			if(!jConstants.isNull(TERMS_AND_CONDITION)){		
				termsAndConditions = Utils.getDecodedString(jConstants.getString(TERMS_AND_CONDITION));
			}
			if(!jConstants.isNull(MAX_POST_IN_MONTH)){		
				maxPostInMonth = jConstants.getInt(MAX_POST_IN_MONTH);
			}
			
			if(!jConstants.isNull(SERVICE_DISABLED)){	
				isServiceDisabled = "YES".equalsIgnoreCase(jConstants.getString(SERVICE_DISABLED)); 
			}
			if(!jConstants.isNull(DEAL_DISABLED)){
				isDealDisabled = "YES".equalsIgnoreCase(jConstants.getString(DEAL_DISABLED)); 
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	public static final String getSplashImageDirName(){
		return splashImageDirName;
	}
	public static final String getSuperCatImgThumbDirName(){
		return superCatImgThumbDirName;
	}
	public static final String getCatImgThumbDirName(){
		return catImgThumbDirName;
	}
	public static final String getDefaultImgDirName(){
		return defaultImgDirName;
	}
	public static final String getDefaultImgFileName(){
		return defaultImgFileName;
	}
	public static final String getAdImgThumbDirName(){
		return adImgThumbDirName;
	}
	public static final String getAdImgDirName(){
		return adImgDirName;
	}
	public static final String getBannerSmallImgDirName(){
		return bannerSmallImgDirName;
	}
	public static final String getBannerBigImgDirName(){
		return bannerBigImgDirName;
	}
	
	public static final String getTermsAndConditions(){
		return termsAndConditions;
	}
	public static final int getMaxPostInMonth(){
		return maxPostInMonth;
	}
	
	public static final boolean isServiceDisabled(){
		return isServiceDisabled;
	}
	public static final boolean isDealDisabled(){
		return isDealDisabled;
	}
	
}
